<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <cpn></cpn>
  <cpn>
<!--    目的是为了获取子组件中的movies-->
    <template slot-scope="slot">
      <span>{{slot.data.join('-')}}</span>
    </template>
  </cpn>

  <cpn>
    <template slot-scope="slot">
      <span v-for="item in slot.data">{{item}}-</span>
    </template>
  </cpn>
</div>
<template id="cpn">
  <div>
    <slot :data="movies">
      <ul>
        <li v-for="item in movies">{{item}}</li>
      </ul>
    </slot>
  </div>
</template>
<script src="../js/vue.js"></script>
<script>
  const vm=new Vue({
    el:'#app',
    data:{},
    components:{
      cpn:{
        template:'#cpn',
        data(){
          return{
            movies:['西游记','哪吒','西红柿首富','花王','星际穿越']
          }
        }
      }

    }

  })
</script>

</body>
</html>